package org.anyin.gitee.cloud.center.gateway.config;

import org.anyin.gitee.cloud.center.gateway.locator.RedisRouteDefinitionLocator;
import org.anyin.gitee.cloud.lib.core.cache.CacheTemplate;
import org.springframework.cloud.gateway.route.InMemoryRouteDefinitionRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DynamicRouteConfig {
    /**
     * 动态路由配置
     */
    @Bean
    public RedisRouteDefinitionLocator redisRouteDefinitionLocator(InMemoryRouteDefinitionRepository repository, CacheTemplate cacheTemplate){
        return new RedisRouteDefinitionLocator(repository, cacheTemplate);
    }
}
